package com.chainyoung.component_tmtrade.ui.view;

import android.content.Context;
import android.graphics.Color;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutCompat;
import android.util.AttributeSet;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.chainyoung.common.utils.ConvertUtils;
import com.chainyoung.component_tmtrade.R;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;

public class RecieveAccountsView extends LinearLayout {


    public RecieveAccountsView(Context context) {
        super(context);
    }

    public RecieveAccountsView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public RecieveAccountsView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    public void setViews(List<Integer> data) {
        this.setOrientation(HORIZONTAL);
        int totalWidth = this.getWidth();
        this.removeAllViews();
        if (data.isEmpty()){return;}
        for (Integer item : data) {
            ImageView imageView = new ImageView(getContext());
            int width= ConvertUtils.dp2px(getContext(),25);
            imageView.setLayoutParams(new LinearLayoutCompat.LayoutParams(width,width));
            switch (item){
                case 1:
                    //银行卡
                    imageView.setImageResource(R.mipmap.ic_bank_card);
                    break;
                case 2:
                    //支付宝
                    imageView.setImageResource(R.mipmap.ic_alipay);
                    break;
                case 3:
                    //微信
                    imageView.setImageResource(R.mipmap.ic_weixin);
                    break;

            }
            this.addView(imageView);
        }
    }


}

